#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Farmer Li, 公众号: 很酷的程序员/RealCoolEngineer
# @Date: 2021-04-01

l = [1, 'a', 2, 'b', 3, 'c']

# Method 1
num = l[::2]
letter = l[1::2]
print(f'Method 1 num: {num}')
print(f'Method 1 str: {letter}')

# Method 2
num = [v for v in l if isinstance(v, (int, float))]
letter = [v for v in l if isinstance(v, str)]
print(f'Method 2 num: {num}')
print(f'Method 2 str: {letter}')

# Method 3
num = list(filter(lambda v: isinstance(v, (int, float)), l))
letter = list(filter(lambda v: isinstance(v, (str)), l))
print(f'Method 3 num: {num}')
print(f'Method 3 str: {letter}')
